package ch8;

import java.lang.reflect.Method;

public class CalcTest {

	public static void main(String[] args) throws Exception, SecurityException {
		// 注解起作用
		Calc c = new Calc();
		Class cc = c.getClass();
		Method m = cc.getDeclaredMethod("mul", int.class, int.class);
		if (m.isAnnotationPresent(Test.class)) {
			Test t = m.getAnnotation(Test.class);
			System.out.println(t.before());
			Object o = m.invoke(c, 3, 9);
			System.out.println(o);
			System.out.println(t.after());
		} else {
			Object o = m.invoke(c, 3, 9);
			System.out.println(o);
		}
		/*
		 * int r = c.add(3, 6); System.out.println(r);
		 */
	}

}
